<!--
 * @Author: your name
 * @Date: 2022-02-23 10:18:28
 * @LastEditTime: 2022-02-23 10:26:05
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \day03\5-浮动.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>浮动</title>
    <style>
        /* 使用了浮动的元素如果当前行占满会自动换行 */
        .child{
            width: 100px;
            height: 100px;
            float: left;
        }
        /* 表示选中第二个孩子 */
        div:nth-child(2){
            height: 110px;
            
        }
        /* 表示选中所有的奇数孩子 */
        div:nth-child(odd){
            background-color: pink;
        }
         /* 表示选中所有的偶数孩子 */
        div:nth-child(even){
            background-color: red;
        }
    </style>
</head>
<body>
    <div class="child">1</div>
    <div class="child">2</div>
    <div class="child">3</div>
    <div class="child">4</div>
    <div class="child">5</div>
    <div class="child">6</div>
    <div class="child">7</div>
    <div class="child">8</div>
    <div class="child">9</div>
    <div class="child">10</div>
</body>
</html>